# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Run.V2.Model.UtilStatusProto do
  @moduledoc """
  Wire-format for a Status object

  ## Attributes

  *   `canonicalCode` (*type:* `integer()`, *default:* `nil`) - The canonical error code (see codes.proto) that most closely corresponds to this status. This may be missing, and in the common case of the generic space, it definitely will be.
  *   `code` (*type:* `integer()`, *default:* `nil`) - Numeric code drawn from the space specified below. Often, this is the canonical error space, and code is drawn from google3/util/task/codes.proto
  *   `message` (*type:* `String.t`, *default:* `nil`) - Detail message
  *   `messageSet` (*type:* `GoogleApi.Run.V2.Model.Proto2BridgeMessageSet.t`, *default:* `nil`) - message_set associates an arbitrary proto message with the status.
  *   `space` (*type:* `String.t`, *default:* `nil`) - The following are usually only present when code != 0 Space to which this status belongs
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :canonicalCode => integer() | nil,
          :code => integer() | nil,
          :message => String.t() | nil,
          :messageSet => GoogleApi.Run.V2.Model.Proto2BridgeMessageSet.t() | nil,
          :space => String.t() | nil
        }

  field(:canonicalCode)
  field(:code)
  field(:message)
  field(:messageSet, as: GoogleApi.Run.V2.Model.Proto2BridgeMessageSet)
  field(:space)
end

defimpl Poison.Decoder, for: GoogleApi.Run.V2.Model.UtilStatusProto do
  def decode(value, options) do
    GoogleApi.Run.V2.Model.UtilStatusProto.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Run.V2.Model.UtilStatusProto do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
